#ifndef USERMANAGER_H
#define USERMANAGER_H

#include <QString>
#include <QJsonObject>
#include <QDateTime>
#include <vector>

struct User {
    QString username;
    QString password;
    QString lastLoginTime;
    int permissions;
};

class UserManager
{
public:
    UserManager();
    ~UserManager();

    bool createUser(const QString& username, const QString& password);
    bool createAdmin();
    User login(const QString& username, const QString& password);
    QString getLastLoginTime(const QString& username);
    bool checkUserExists(const QString& username);
    std::vector<User> getAllUsers();
    bool deleteUser(const QString& username);

private:
    QString getUserFilePath() const;
    void createInitialUserFile();
    void saveUserFile(const QJsonObject& jsonObject);
    QJsonObject loadUserFile() const;
};

#endif // USERMANAGER_H
